isbg.isbg.ISBG
- class isbg.isbg.ISBG
Main ISBG class.
See also
isbg.__main__for command line usage.Examples
>>> import isbg >>> sbg = isbg.ISBG() >>> sbg.imapsets.host = "imap.example.org" >>> sbg.imapsets.port = 993 >>> sbg.imapsets.user = "example@example.org" >>> sbg.imapsets.passwd = "xxxxxxxx" >>> sbg.imapsets.inbox = "INBOX" >>> sbg.imapsets.spaminbox = "INBOX.Spam" >>> sbg.imapsets.learnspambox = "INBOX.Spam" >>> sbg.imapsets.learnhambox = "NOSPAM" >>> # Set the number of mails to chech >>> sbg.partialrun = 4 # Only check 4 mails for every proc. >>> sbg.verbose = True # Show more info >>> sbg.ignorelockfile = True # Ignore lock file >>> sbg.removelock() # if there is a lock file >>> sbg.do_isbg() # Connects to the imap and checks for spam
- imap
class that take care of connection and communication with the IMAP server. It’s initialized calling
do_imap_login()and every time that callingdo_isbg().- Type:
- imapsets
Object to store the IMAP settings. It’s initialized when ISBG is initialized and also stores the IMAP folders used by ISBG.
- It also stores the command line args for:
user(imapuser),passwd(imappasswd),host(imaphost),port(imapport),nossl(nossl),inbox(imapinbox),spaminbox(spaminbox),learnspambox(learnspambox) andlearnhambox(learnhambox).
- logger
Object used to output info. It’s initialized when ISBG is initialized.
- Type:
These are attributes derived from the command line and needed for normal operations:
- verbose
a property that if it’s set to True show more information. Default to
False.
These are attributes derived for the command line, and needed for SpamAssassin operations:
- deletehigherthan
If it’s not None, the minimum score from a mail to be deleted. Default to
None.- Type:
- expunge
If True causes marked for deletion messages to also be deleted (only useful if deleted is True. Default to
None.- Type:
- movehamto
If it’s not None, IMAP folder where the ham mail will be moved. Default to
None.- Type:
These are attributes derived from the command line and related to the lock file:
- lockfile
Full path and name of the lock file.
The path it’s initialized with the xdg cache home specification plus /isbg/ and with the name
lock.- Type:
These are attributes derived for the command line, related to the IMAP password and files:
- passwdfilename
The fill name where the password will be stored. Defaults to
None. It only have use if savepw is True.- Type:
- trackfile
Base name where the processed
uidswill be stored to not reprocess them. Default toNonewhen initialized and initialized the first time that is needed.- Type:
- __init__()
Initialize a ISBG object.
Methods
__init__()Initialize a ISBG object.
assertok(res, *args)Check that the return code is OK.
Login to the imap.
Sign off from the imap connection.
do_isbg()Execute the main isbg process.
List the imap boxes.
Do the spamassassin procesing.
pastuid_read(uidvalidity[, folder])Read the uids stored in a file for a folder.
pastuid_write(uidvalidity, origpastuids, ...)Write the uids in a file for the folder.
Remove the lockfile.
set_filename(imapsets, filetype)Set the filename of cached created files.
Attributes
Get the verbose property.
a logger